package com.maggie.measure.intercept;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

public class ServiceInterceptor implements MethodInterceptor {


    public ServiceInterceptor() {

    }


    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        long start = System.currentTimeMillis();
        Object result = methodInvocation.proceed();
        long end = System.currentTimeMillis();
        System.out.println("AOP 拦截 SERVICE 花费时间: " + (end - start) + " ms");
        return result;
    }
}
